using MediatR;
using S.O.ErrorCode;
using System.ComponentModel.DataAnnotations;

namespace S.O.Api.Write.Application.Command.Medical
{
    /// <summary>
    /// 创建病历记录命令
    /// 用于医生为患者创建电子病历，包含完整的病历信息
    /// </summary>
    public class CreateMedicalRecordCommand : IRequest<APIResult<string>>
    {
        /// <summary>
        /// 患者ID
        /// </summary>
        [Required(ErrorMessage = "患者ID不能为空")]
        public long PatientId { get; set; }

        /// <summary>
        /// 患者姓名
        /// </summary>
        [Required(ErrorMessage = "患者姓名不能为空")]
        [StringLength(50, ErrorMessage = "患者姓名长度不能超过50个字符")]
        public string PatientName { get; set; } = string.Empty;

        /// <summary>
        /// 主诉
        /// 患者的主要症状和就诊原因
        /// </summary>
        [Required(ErrorMessage = "主诉不能为空")]
        [StringLength(500, ErrorMessage = "主诉长度不能超过500个字符")]
        public string ChiefComplaint { get; set; } = string.Empty;

        /// <summary>
        /// 现病史
        /// 患者现在疾病的发生、发展过程
        /// </summary>
        [Required(ErrorMessage = "现病史不能为空")]
        [StringLength(2000, ErrorMessage = "现病史长度不能超过2000个字符")]
        public string PresentIllness { get; set; } = string.Empty;

        /// <summary>
        /// 既往史
        /// 患者既往疾病史、手术史、外伤史等
        /// </summary>
        [StringLength(1000, ErrorMessage = "既往史长度不能超过1000个字符")]
        public string PastHistory { get; set; } = string.Empty;

        /// <summary>
        /// 过敏史
        /// 患者的药物过敏史、食物过敏史等
        /// </summary>
        [StringLength(500, ErrorMessage = "过敏史长度不能超过500个字符")]
        public string AllergyHistory { get; set; } = string.Empty;

        /// <summary>
        /// 个人史
        /// 患者的生活习惯、职业史、婚育史等
        /// </summary>
        [StringLength(1000, ErrorMessage = "个人史长度不能超过1000个字符")]
        public string PersonalHistory { get; set; } = string.Empty;

        /// <summary>
        /// 家族史
        /// 患者家族遗传病史、家族疾病史等
        /// </summary>
        [StringLength(1000, ErrorMessage = "家族史长度不能超过1000个字符")]
        public string FamilyHistory { get; set; } = string.Empty;

        /// <summary>
        /// 体格检查
        /// 生命体征、各系统检查结果
        /// </summary>
        [StringLength(2000, ErrorMessage = "体格检查长度不能超过2000个字符")]
        public string PhysicalExam { get; set; } = string.Empty;

        /// <summary>
        /// 辅助检查
        /// 实验室检查、影像学检查等结果
        /// </summary>
        [StringLength(2000, ErrorMessage = "辅助检查长度不能超过2000个字符")]
        public string AuxiliaryExam { get; set; } = string.Empty;

        /// <summary>
        /// 治疗建议
        /// 诊断结果和治疗方案，包括用药方案、注意事项等
        /// </summary>
        [Required(ErrorMessage = "治疗建议不能为空")]
        [StringLength(2000, ErrorMessage = "治疗建议长度不能超过2000个字符")]
        public string TreatmentAdvice { get; set; } = string.Empty;

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 医生姓名
        /// </summary>
        [Required(ErrorMessage = "医生姓名不能为空")]
        [StringLength(50, ErrorMessage = "医生姓名长度不能超过50个字符")]
        public string Doctor { get; set; } = string.Empty;
    }
}